package cate.game.play.skill.effect;


import cate.common.table.d.GDCamp;
import cate.game.attr.FightAttr;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.base.SE;

public class AttrPair {

    public FightAttr actor;
    public FightAttr target;

    public static AttrPair calc(SE se, SkillActionCtx action, Fighter target) {
        AttrPair pair = new AttrPair();
        pair.actor = action.getActor().attr.total();
        FightAttr actorTemp = se.parent.getActorAttr(target.getPid());
        if (se instanceof 伤害SE) {
            if (GDCamp.Type.counter(action.getActor().getCamp(), target.getCamp())) {
                actorTemp.add(new FightAttr(GDCamp.COUNTER_ATTR_STR));
            }
        }
        if (!actorTemp.isEmpty()) {
            pair.actor = pair.actor.copy().add(actorTemp);
        }
        pair.target = target.attr.total();

        FightAttr targetTemp = se.parent.getTargetAttr(target.getPid());
        if (targetTemp != null && !targetTemp.isEmpty()) {
            pair.target = pair.target.copy().add(targetTemp);
        }
        return pair;
    }
}
